package demo1;

import java.util.Scanner;
public class Test {
    public static void main(String[] args) {
        //：输入两个字符串a和b，字符串内容为二进制数字，求两个字符串相加的结果，
        // 加法计算方法以二进制方式计算，并返回对应的字符串结果。要求程序尽可能的高效。
        //字符串长度不超过100
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()){
            String str1 = in.nextLine();
            String str2 = in.nextLine();
            Solution solution = new Solution();
            String ret = solution.solve(str1,str2);
            System.out.println(ret);
        }
    }
     static class Solution {
        public String solve(String str1, String str2) {
            int len1 = str1.length();
            int len2 = str2.length();
            int maxLen = Math.max(len1,len2);
            StringBuilder strB1 = new StringBuilder(str1).reverse();
            StringBuilder strB2 = new StringBuilder(str2).reverse();
            StringBuilder str = new StringBuilder();
            Boolean flag = false;//代表不进位
            for(int i = 0;i < maxLen;i++){
                char ch1 = i< len1?strB1.charAt(i):'0';
                char ch2 = i< len2?strB2.charAt(i):'0';
                if(ch1=='0'&&ch2=='0'){
                    str.append(flag?'1':'0');
                    flag = false;//相加为0,不用进一
                }else if(ch1 == '1'&& ch2 == '1'){
                    str.append(flag?'1':'0');
                    flag = true; //相加要进1
                }else{
                    str.append(flag?'0':'1');//注意
                }
            }
            if(flag == true){
                str.append('1');
            }
            return str.reverse().toString();
        }
    }
}
